<?php
class Admin_Model_Presse extends Zend_Db_Table_Abstract
{
    protected $_name = 'presse';
	protected $_primary  = 'p_presse';
    
	public function getListPresse() 
	{
		$sql = $this->getAdapter()->select()
		->from($this->_name)
		->order('dtpubli desc');
		
		return $this->getAdapter()->fetchAll($sql);
	}

	public function getPresse($id)
	{
		$sql = $this->getAdapter()->select()
		->from($this->_name)
		->where('p_presse = ?', $id);
		
		return $this->getAdapter()->fetchRow($sql);
	}

	
	public function removePresse($id)
	{
		$this->getAdapter()->delete($this->_name, "p_presse =" . $id);
		return true;
	}
	
    public function getFichier($id)
	{
	    $sql = "SELECT fichier FROM ". $this->_name ." WHERE p_actu = $id";
	    return $this->getAdapter()->fetchRow($sql);
	}
	
    public function getVignette($id)
	{
	    $sql = "SELECT vignette FROM ". $this->_name ." WHERE p_actu = $id";
	    return $this->getAdapter()->fetchRow($sql);
	}

}